#ifndef _F8913D_H_
#define _F8913D_H_

#include "common_def.h"

enum F8913D_MODE_T
{
  // F8913D_UART_MODE,
  F8913D_AT_MODE,
  F8913D_API_MODE
};

enum F8913D_TYPE_T
{
  F8913D_TYPE_COORDINATOR,
  F8913D_TYPE_ROUTER,
  F8913D_TYPE_DEVICE
};

struct FF_PACKET_T;
typedef void (*ff_packet_handler_t)(struct FF_PACKET_T* packet);
typedef void (*ff_at_handler_t)(uint8 c);
typedef void (*ff_ready_handler_t)(void);

void f8913d_init(void);
void f8913d_set_at_handler(ff_at_handler_t at_handler);
void f8913d_set_packet_handler(ff_packet_handler_t handler);
void f8913d_set_mode(enum F8913D_MODE_T mode);

void f8913d_send(const uint8* data, uint16 size);
void f8913d_display(const uint8* data, uint16 size);

void f8913d_send_packet(struct FF_PACKET_T* packet);
void f8913d_check_input(void);

void f8913d_sleep(void);
void f8913d_wakeup(ff_ready_handler_t on_ready);
bool f8913d_is_sleep(void);
void f8913d_set_deep_sleep_mode(void);

// Configure F8913D, in API mode
// valid channel: 11 to 26
void f8913d_set_zigbee_channel_id(uint16 channel_id);
void f8913d_set_zigbee_pan_id(uint16 pan_id);
void f8913d_set_zigbee_device_id(uint16 device_id);
void f8913d_set_zigbee_device_type(enum F8913D_TYPE_T type);

void f8913d_query_zigbee_channel_id();
void f8913d_query_zigbee_pan_id();
void f8913d_query_zigbee_device_id();
void f8913d_query_zigbee_device_type();
 //By WL 2016-4-29
void f8913d_zigbee_saveSetting();
void f8913d_zigbee_restart();
void f8913d_query_zigbee_net_state();

void FFpacket_put_byte(uint8 c);

#endif // _F8913D_H_
